package com.dinghui.salary.controller;


import com.alibaba.dubbo.config.annotation.Reference;
import com.dinghui.salary.pojo.MonthSalary;
import com.dinghui.salary.pojo.User;
import com.dinghui.salary.pojo.dto.MonthSalaryDTO;
import com.dinghui.salary.pojo.dto.MouthTypeDTO;
import com.dinghui.salary.pojo.dto.SalaryStructureDTO;
import com.dinghui.salary.pojo.dto.SearchMouthTypeDTO;
import com.dinghui.salary.service.MonthSalaryService;
import com.dinghui.salary.utils.ApiResult;
import com.dinghui.salary.utils.LocalUser;
import com.dinghui.salary.utils.PagedGridResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * @author tanrentao
 * @date 2021-09-06
 * @desc 月工资结构
 */
@RestController
@RequestMapping("/monthSalary")
@Api(value = "MonthSalaryController", tags = "月工资结构")
public class MonthSalaryController {

    @Reference(version = "2.0.0")
    MonthSalaryService monthSalaryService;

    @ApiOperation("增加")
    @PostMapping("/create")
    public ApiResult create (@RequestBody MonthSalaryDTO dto) {
        return ApiResult.success(monthSalaryService.create(dto));
    }

    @ApiOperation("修改")
    @PostMapping("/update")
    public ApiResult update (@RequestBody MonthSalaryDTO dto) {
        return ApiResult.success(monthSalaryService.update(dto));
    }

    @ApiOperation("删除")
    @GetMapping("/delete/{id}")
    public ApiResult delete(@PathVariable String id) {
        return ApiResult.success(monthSalaryService.delete(id));
    }

    @ApiOperation("查询月工资类型列表")
    @PostMapping("/getMonthSalaryList")
    public ApiResult getMonthSalaryList(@RequestBody MonthSalaryDTO dto) {
        PagedGridResult pagedGridResult = monthSalaryService.selectMonthSalaryList(dto);
        return ApiResult.success(pagedGridResult);
    }

}
